package com.controller.setting;



import com.comm.R;
import com.comm.vo.JsonResult;
import com.entity.Employee;
import com.service.setting.SysEmployeeService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;



@RequestMapping("/setting/doctorManage")
@RestController
@Api(value = "员工数据test",tags = "员工数据信息接口API")
public class SysEmployeeController {

    @Autowired
    SysEmployeeService sysEmployeeService;



    //分页查询所有员工信息
    @RequestMapping(value = ("/findEmpList"),method = RequestMethod.GET)
    @ApiOperation(value = "分页显示所有员工接口",notes = "分页查询所有员工信息",httpMethod = "get", response = JsonResult.class)
    @ApiImplicitParams({
            @ApiImplicitParam(name = "currentPage",value = "当前页码",paramType = "query",dataType = "int",required = true),
            @ApiImplicitParam(name = "pageSize",value = "每页显示条数",paramType = "query",dataType = "int",required = true)
    })
    public JsonResult findEmpList(@RequestParam(name = "currentPage")Integer currentPage,
                                  @RequestParam(name = "pageSize")Integer pageSize){

        return sysEmployeeService.findEmpList(currentPage,pageSize);

    }


    //根据姓名查询员工信息
    @RequestMapping(value = ("/findEmpByEmpName"),method = RequestMethod.GET)
    @ApiOperation(value = "条件查询员工信息接口",notes = "根据姓名查询员工信息",httpMethod = "get", response = R.class)
    @ApiImplicitParam(name = "emp_name",value = "用户名",required = true,dataType = "String",paramType = "query")
    public R findEmpByName(@RequestParam(name = "emp_name")String emp_name){

        return  sysEmployeeService.findEmpByName(emp_name);
    }


    //已禁用人数按钮
    @RequestMapping(value = ("/findEmpStopNum"),method = RequestMethod.POST)
    @ApiOperation(value = "显示已禁用员工信息接口",notes = "显示已禁用人数，点击查看已禁用人员信息(分页显示)",httpMethod = "post", response = JsonResult.class)
    public JsonResult findEmpStopNum(){

        JsonResult empStopNum = sysEmployeeService.findEmpStopNum();

        return empStopNum;
    }

    //添加医生
    @RequestMapping(value = ("/addEmp"),method = RequestMethod.POST)
    @ApiOperation(value = "添加员工接口",notes = "添加员工信息",httpMethod = "post", response = R.class)
    @ApiImplicitParams({
            @ApiImplicitParam(name = "emp_name",value = "员工姓名",paramType = "query",dataType = "String",required = true),
            @ApiImplicitParam(name = "office_id",value = "所在科室id",paramType = "query",dataType = "int",required = true),
            @ApiImplicitParam(name = "emp_grade",value = "员工级别",paramType = "query",dataType = "int",required = true),
            @ApiImplicitParam(name = "emp_phone_num",value = "手机号",paramType = "query",dataType = "String",required = true),
            @ApiImplicitParam(name = "emp_age",value = "年龄",paramType = "query",dataType = "int",required = true),
            @ApiImplicitParam(name = "menu_id",value = "角色id",paramType = "query",dataType = "int",required = true)
    })
    public R addEmp(Employee employee){

        return  sysEmployeeService.addEmp(employee);
    }

    //编辑员工信息
    @RequestMapping(value = ("/updateEmp"),method = RequestMethod.POST)
    @ApiOperation(value = "编辑员工接口",notes = "修改员工信息",httpMethod = "post", response = R.class)
    @ApiImplicitParams({
            @ApiImplicitParam(name = "id",value = "员工id",paramType = "query",dataType = "int",required = true),
            @ApiImplicitParam(name = "emp_name",value = "员工姓名",paramType = "query",dataType = "String",required = true),
            @ApiImplicitParam(name = "emp_sex",value = "性别",paramType = "query",dataType = "String",required = false),
            @ApiImplicitParam(name = "emp_age",value = "年龄",paramType = "query",dataType = "byte",required = false),
            @ApiImplicitParam(name = "office_id",value = "所在科室id",paramType = "query",dataType = "int",required = true),
            @ApiImplicitParam(name = "emp_grade",value = "员工级别",paramType = "query",dataType = "String",required = true),
            @ApiImplicitParam(name = "menu_id",value = "员工职务id",paramType = "query",dataType = "byte",required = true),
            @ApiImplicitParam(name = "photo",value = "头像路径",paramType = "query",dataType = "String",required = false),
            @ApiImplicitParam(name = "doctor_adept",value = "医生擅长",paramType = "query",dataType = "String",required = false),
            @ApiImplicitParam(name = "doctor_introduce",value = "医生介绍",paramType = "query",dataType = "String",required = false)
    })
    public R updateEmp(Employee employee){

        return  sysEmployeeService.updateEmp(employee);
    }

    //点击禁用按钮
    @RequestMapping(value = ("/stopEmpById"),method = RequestMethod.POST)
    @ApiOperation(value = "禁用员工接口",notes = "根据员工Id禁用员工信息",httpMethod = "post", response = R.class)
    @ApiImplicitParam(name = "id",value = "员工Id",required = true,dataType = "int",paramType = "query")
    public R stopEmpById(@RequestParam(name = "id")Integer id){

        return  sysEmployeeService.stopEmpById(id);
    }

    //点击启用按钮
    @RequestMapping(value = ("/startEmpById"),method = RequestMethod.POST)
    @ApiOperation(value = "启用员工接口",notes = "根据员工Id启用员工",httpMethod = "post", response = R.class)
    @ApiImplicitParam(name = "id",value = "员工Id",required = true,dataType = "int",paramType = "query")
    public R startEmpById(@RequestParam(name = "id")Integer id){

        return sysEmployeeService.startEmpById(id);
    }






}
